const Subscription = require('egg').Subscription;
class SetWeixinMenu extends Subscription {
    // 通过 schedule 属性来设置定时任务的执行间隔等配置
    static get schedule() {
        return {
            cron: '0 0 0 * * *', //0 am every day
            type: 'worker',
            immediate: true
        };
    }

    async subscribe() {
        await this.ctx.curl(`http://localhost:8080/initMenu`);
        //初始化unionId
        await this.ctx.curl(`http://localhost:8080/initUnionId`);
    }
}

module.exports = SetWeixinMenu;
